import time

from selenium.webdriver.common.by import By
from selenium import webdriver
import pytest
@pytest.fixture
def driver():
    driver=webdriver.Edge()
    driver.get('http://10.59.9.12:7001/')
    driver.maximize_window()
    yield driver
    time.sleep(2)
    driver.quit()
def test_A3mall_01(driver):
    #点击登录
    driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').click()
    time.sleep(2)
    #断言会员登录
    dy1=driver.find_element(By.CLASS_NAME,'reg-new').text
    print(dy1)
    #输入用户名
    driver.find_element(By.XPATH,'//input[@type="text" and @name="username"]').send_keys('13681034647')
    time.sleep(2)
    #输入密码
    driver.find_element(By.XPATH,'//input[@type="password" or name="password"]').send_keys('111111')
    time.sleep(10)
    #点击登录按钮
    driver.find_element(By.XPATH,'//*[@id="theForm"]/div[5]/a').click()
    time.sleep(5)
    #断言欢迎回来，13681034647
    dy2=driver.find_element(By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a').text
    print(dy2)
if __name__ == '__main__':
    pytest.main()